import axios from 'axios'

// axios.defaults.headers['Content-Type'] = 'application/json;charset=UTF-8'
// axios.defaults.headers['Content-Type'] = 'multipart/form-data'
const baseUrlRen = 'http://10.110.15.235:8080'
// 10.110.15.235 fuwuqi
// ren 10.112.70.120
// 10.8.215.236
const instance = axios.create()
// instance.defaults.timeout = 100000
instance.interceptors.request.use((config) => {
  console.log('multipart/form-data')
  config.headers['Content-Type'] = 'multipart/form-data'
  console.log(config)
  return config
}, (error) => {
  return Promise.reject(error)
})
export function fetch (url, params) {
  return new Promise((resolve, reject) => {
    instance.post(url, params)
      .then(response => {
        resolve(response)
      })
      .catch(error => {
        reject(error)
      })
  })
}

export default {
  // 批量导入科目信息
  addImportSubject (params) {
    return fetch(`${baseUrlRen}/recruit_wechat/first_batch/add_by_excel`, params)
  }
}
